package com.yunxi.service.dubboService.impl.sys;

import com.github.pagehelper.PageInfo;
import com.yunxi.model.sys.Affiche;
import com.yunxi.service.localService.sys.AfficheService;
import com.yunxi.sys.pojo.AfficheVO;
import com.yunxi.sys.service.AfficheDubboService;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.RepositoryService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 
 * @since 2019-07-15
 */
public class AfficheDubboServiceImpl implements AfficheDubboService {

    @Autowired
    @Qualifier(value = "afficheServiceImpl")
    AfficheService afficheService;
    @Autowired
    private RepositoryService repositoryService;
    @Autowired
    ProcessEngine processEngine;

    @Override
    public AfficheVO getByAfficheId(String id) throws InvocationTargetException, IllegalAccessException {
        AfficheVO afficheVO = afficheService.getByAfficheId(id);

        return afficheVO;
    }

    @Override
    public void saveOrUpdate(AfficheVO afficheVO) throws InvocationTargetException, IllegalAccessException {
        Affiche affiche = new Affiche();
        BeanUtils.copyProperties(afficheVO, affiche);
        afficheService.saveOrUpdate(affiche);
    }

    @Override
    public void removeById(Long id) {
        afficheService.removeById(id);
    }

    @Override
    public PageInfo<AfficheVO> findPageByVO(AfficheVO afficheVO, Integer pageNum, Integer pageSize) throws InvocationTargetException, IllegalAccessException {
      PageInfo<AfficheVO> pageInfo = afficheService.pageByVo(afficheVO,pageNum,pageSize);
      return pageInfo;
   }

    @Override
    public void removeByListVo(List<AfficheVO> afficheVOList) throws IllegalAccessException, InvocationTargetException, InstantiationException {
        afficheService.removeByListVo(afficheVOList);
    }

    @Override
    public List listByVo(AfficheVO afficheVO) {
      return afficheService.listByVo(afficheVO);
    }

    @Override
    public AfficheVO getNewAffiche(String afficheType) throws InvocationTargetException, IllegalAccessException {
        return afficheService.getNewAffiche(afficheType);
    }

}
